package com.alex.core.contants.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 设备路数状态
 * @author cb
 * @date 2019/10/23 13:27
 */
@Getter
@AllArgsConstructor
public enum DeviceWaysStatusEnum {
    // 设备端口状态,1-使用中,2-空闲,3-故障,4-我预约,5-其他人预约
    USING(1, "使用中"),
    FREE(2, "空闲"),
    IN_TROUBLE(3, "故障"),
    MY_ORDER(4, "我预约"),
    OTHRE_ORDER(5, "其他人预约"),
    ;

    private final Integer code;
    private final String value;

    public static DeviceWaysStatusEnum getByCode(Integer code) {
        for (DeviceWaysStatusEnum deviceWaysStatusEnum : values()) {
            if (deviceWaysStatusEnum.getCode().equals(code)) {
                return deviceWaysStatusEnum;
            }
        }
        return null;
    }
}
